#!/usr/bin/env python


import os
import sys

sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from runtest_dalton import Filter, TestRun

test = TestRun(__file__, sys.argv)

f = Filter()

f.add(string = 'Final HF energy',
      abs_tolerance = 1.0e-9)

f.add(from_string = 'Electrostatic contributions:',
      num_lines = 13,
      abs_tolerance = 1.0e-8)

f.add(from_string = 'CC2 Total  energy',
      num_lines = 2,
      abs_tolerance = 1.0e-8)

f.add(from_string = 'CC2        Excitation energies',
      num_lines = 6,
      rel_tolerance = 5.0e-5)

f.add(from_string = 'CC2        Length   Gauge Oscillator Strength',
      num_lines = 6,
      abs_tolerance = 1.0e-5)

test.run(['pecc2.dal'], ['formaldehyde.mol'], ['water.pot'], f={'out': f},
         accepted_errors=['not implemented for parallel calculations.'])

sys.exit(test.return_code)


#
